

# include "banner.h"


# include <malloc.h>
# include "keyvalue_banner.h"

pKeyValue InitKeyValue(pWord pWordTest, pNode pNodeTest)
{
	if (pWordTest == NULL || pNodeTest == NULL)
		return NULL;

	pKeyValue pKeyValueTest;
	pKeyValueTest = (pKeyValue)malloc(sizeof(KeyValue));
	pKeyValueTest->pNode = pNodeTest;
	pKeyValueTest->pWord = pWordTest;
	pKeyValueTest->Value = 1;
	return pKeyValueTest;
}

State_banner DeleteKeyValue(KeyValue **pKeyValueTest)
{
	if (pKeyValueTest != NULL)
	{
		DeleteNode(&(*pKeyValueTest)->pNode);
		DeleteWord(&(*pKeyValueTest)->pWord);
		free(*pKeyValueTest);
		*pKeyValueTest = NULL;
	}
	return 0;
}

State_banner ShowKeyValue(pKeyValue pKeyValueTest)
{
	if (pKeyValueTest != NULL)
	{
		ShowWord(pKeyValueTest->pWord);
		ShowAllNode(pKeyValueTest->pNode);
	}
	return 0;
}


